package SuperKeyWord;

/**
 * @author Jimmy
 * @date 2022/11/14 - 18:50
 */
public class Account {
    private int id;
    private double balance;
    private double annualInterestRate;

    public Account(){

    }

    public Account(int id, double balance, double annualInterestRate) {
        this.id = id;
        this.balance = balance;
        this.annualInterestRate = annualInterestRate;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    public double getAnnualInterestRate() {
        return annualInterestRate;
    }

    public void setAnnualInterestRate(double annualInterestRate) {
        this.annualInterestRate = annualInterestRate;
    }

    public double getMonthlyInterest(){
        return (getAnnualInterestRate() / 12);
    }

    public void withdraw(double amount){
        System.out.println("Withdraw: " + amount);
        if (amount <= balance){
            balance -= amount;
        } else {
            System.out.println("Money Not Enough.");
        }

    }

    public void deposit(double amount){
        System.out.println("Deposit: " + amount);
        balance += amount;
    }
}
